package com.hivekion.system.controller;

import com.hivekion.common.annotation.AutoLog;
import com.hivekion.common.entity.PagedResultVo;
import com.hivekion.common.entity.SearchInputVo;
import com.hivekion.common.enums.OperationTypeEnum;
import com.hivekion.system.domain.vo.SysUserBindCreateInputVo;
import com.hivekion.system.domain.vo.SysUserBindModelVo;
import com.hivekion.system.domain.vo.SysUserBindUpdateInputVo;
import com.hivekion.system.service.ISysUserBindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/system/userBind")
public class SysUserBindController {
      @Autowired
      ISysUserBindService service;

      @GetMapping("/getInfo")
      @AutoLog(value = "角色查询", operationType = OperationTypeEnum.SELECT, module = "系统管理/角色管理")
      public SysUserBindModelVo getInfo(String userId) {
	    return service.getInfo(userId);
      }

      @PostMapping("/add")
      @PreAuthorize("@Permission.hasPermi('pro:sys:role:add')")
      @AutoLog(value = "新增角色绑定关系", operationType = OperationTypeEnum.INSERT, module = "系统管理/角色管理")
      public boolean add(@RequestBody SysUserBindCreateInputVo inputVo) {
	    return service.add(inputVo);
      }

      @PutMapping("/edit")
      @PreAuthorize("@Permission.hasPermi('pro:sys:role:edit')")
      @AutoLog(value = "变更用户绑定信息", operationType = OperationTypeEnum.UPDATE, module = "系统管理/角色管理")
      public boolean edit(@RequestBody SysUserBindUpdateInputVo inputVo) {
	    return service.edit(inputVo);
      }

      @DeleteMapping("/remove")
      @PreAuthorize("@Permission.hasPermi('pro:sys:role:remove')")
      @AutoLog(value = "删除绑定关系", operationType = OperationTypeEnum.DELETE, module = "系统管理/角色管理")
      public boolean remove(String roleId) {
	    return service.remove(roleId);
      }

      @GetMapping("/getList")
      public PagedResultVo<SysUserBindModelVo> getList(SearchInputVo inputVo) {
	    return service.getList(inputVo);
      }
}
